#include<stdio.h>
int main()
{
	int x,y,i,a[3],j=0;
	scanf("%d %d",&x,&y);
	for(i=0;i<3;i++)
	scanf("%d",&a[i]);
	if(x>y)
	{
		for(i=0;i<3;i++)
		if(a[i]==0)
		j++;
		if(j!=0)
		printf("The winner is a: %d + %d",x,j);
		else
		printf("The winner is b: %d + 3",y,j);
	}
	else
	{
		for(i=0;i<3;i++)
		if(a[i]==1)
		j++;		
		if(j!=0)
		printf("The winner is b: %d + %d",y,j);
		else
		printf("The winner is a: %d + 3",x,j);
	}
	return 0;
 } 
